﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ICM_Asset_Warranty.aspx.cs" Inherits="KPIS.GERP.GIMS.APP.APP_UI.Add_Form.ICM_Asset_Warranty" %>

<html >
<head runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <title>เพิ่ม /แก้ไข ข้อมูลการประกันภัย</title>
    <link rel="StyleSheet" href="../../Styles/StyleSheet.css" type="text/css"/>
</head>
<body>
    <form id="form1" runat="server">
           <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" >
           </asp:ScriptManager>
           <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
                <script type="text/javascript" src="../../Scripts/Common.js"></script>
                <script type="text/javascript">
                Sys.Application.add_load(setCalendarReceiveTable);
                Sys.Application.add_load(setCalendarEndTable);
                //========================= Receive Date ============================//
                function setCalendarReceiveTable() {
                        var tooltip = $find("<%= ToolTipReceiveDate.ClientID %>");
                        var calendar = $find("<%= CalendarReceiveDate.ClientID %>");                       
                        var fastNavigation = calendar._getFastNavigation();
                        fastNavigation.OnToday =
                        function()
                        {
                            var today = new Date;
                            var date = [today.getFullYear(), today.getMonth()+ 1, today.getDate()];
                            calendar.selectDate(date, true);
                            fastNavigation.Popup.Hide();  
                            var all_date = date.toString().split(",");
                            var year = parseInt(all_date[0]) + 543;
                            var month = all_date[1];
                            var day = all_date[2];
                            if (day.length == 1) {
                                day = '0' + day;
                            }
                            if (month.length == 1) {
                                month = '0' + month;
                            }

                            var maskText = $find("<%= txtReceiveDate.ClientID %>");
                            maskText.set_value(day + month + year);
                            tooltip.hide();
                        }
                    }
                   function OnReceiveDateClick(calendarInstance, args) {
                        var tooltip = $find("<%= ToolTipReceiveDate.ClientID %>");
                        var fastNavigation = calendarInstance._getFastNavigation();
                        var date = args.get_renderDay().get_date().toString();
                        var all_date = date.split(",");
                        var year = parseInt(all_date[0]) + 543;
                        var month = all_date[1];
                        var day = all_date[2];
                        if (day.length == 1) {
                            day = '0' + day;
                        }
                        if (month.length == 1) {
                            month = '0' + month;
                        }

                        var maskText = $find("<%= txtReceiveDate.ClientID %>");
                        maskText.set_value(day + month + year);
                        tooltip.hide();
                    }
                    function OnCalendarReceiveViewChanged(sender, step) {
                        var year = parseInt(sender.FocusedDate[0]) + 543;
                        var month = sender.FocusedDate[1];
                        document.getElementById("CalendarReceiveDate_Title").innerHTML = changeMonthNumberToName(month) + " " + year; 
                    }
                    //========================= End Date ============================//
                    function setCalendarEndTable() {
                            var tooltip = $find("<%= ToolTipEndDate.ClientID %>");
                            var calendar = $find("<%= CalendarEndDate.ClientID %>");                       
                            var fastNavigation = calendar._getFastNavigation();
                            fastNavigation.OnToday =
                            function()
                            {
                                var today = new Date;
                                var date = [today.getFullYear(), today.getMonth()+ 1, today.getDate()];
                                calendar.selectDate(date, true);
                                fastNavigation.Popup.Hide();  
                                var all_date = date.toString().split(",");
                                var year = parseInt(all_date[0]) + 543;
                                var month = all_date[1];
                                var day = all_date[2];
                                if (day.length == 1) {
                                    day = '0' + day;
                                }
                                if (month.length == 1) {
                                    month = '0' + month;
                                }

                                var maskText = $find("<%= txtEndDate.ClientID %>");
                                maskText.set_value(day + month + year);
                                tooltip.hide();
                            }
                        }
                       function OnEndDateClick(calendarInstance, args) {
                            var tooltip = $find("<%= ToolTipEndDate.ClientID %>");
                            var fastNavigation = calendarInstance._getFastNavigation();
                            var date = args.get_renderDay().get_date().toString();
                            var all_date = date.split(",");
                            var year = parseInt(all_date[0]) + 543;
                            var month = all_date[1];
                            var day = all_date[2];
                            if (day.length == 1) {
                                day = '0' + day;
                            }
                            if (month.length == 1) {
                                month = '0' + month;
                            }

                            var maskText = $find("<%= txtEndDate.ClientID %>");
                            maskText.set_value(day + month + year);
                            tooltip.hide();
                        }
                        function OnCalendarEndViewChanged(sender, step) {
                            var year = parseInt(sender.FocusedDate[0]) + 543;
                            var month = sender.FocusedDate[1];
                            document.getElementById("CalendarEndDate_Title").innerHTML = changeMonthNumberToName(month) + " " + year; 
                        }
                        
                        function onTextChangeGeneral(sender) 
                        {
                            if (sender.get_value() == "") {
                                sender.set_text("");
                            }
                        }
                        function GetRadWindow() 
                           {
                                var oWindow = null;
                                if (window.radWindow)
                                    oWindow = window.RadWindow; 
                                else if (window.frameElement.radWindow)
                                    oWindow = window.frameElement.radWindow; 
                                return oWindow;
                            }
                        function CloseWindow() 
                           {
                                 GetRadWindow().Close();
                           }
                </script>
           </telerik:RadCodeBlock>
           <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                        <AjaxSettings>
                            <telerik:AjaxSetting AjaxControlID="Panel1">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                                    <telerik:AjaxUpdatedControl ControlID="Panel2" LoadingPanelID="RadAjaxLoadingPanel1" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                            <telerik:AjaxSetting AjaxControlID="Panel2">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                                    <telerik:AjaxUpdatedControl ControlID="Panel2" LoadingPanelID="RadAjaxLoadingPanel1" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                        </AjaxSettings>
           </telerik:RadAjaxManager>   
           <div class="moduleContent780">
                <div class="moduleDivBottom780">
                     <asp:Panel ID="Panel2" runat="server" CssClass="contentPaneDiv" Height="30px" Width="760px" ScrollBars="Auto" >
                                <table cellpadding="0" cellspacing="0">
                                    <tr class="command-list">
                                        <td>
                                            <asp:LinkButton ID="btnSave" runat="server" CssClass="LinkButton"  onclick="btnSave_Click">
                                                <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cmd_Save.gif" />&nbsp;&nbsp;บันทึกข้อมูล
                                            </asp:LinkButton>
                                            <asp:Label CssClass="font-label" runat = "server" ID= "hWarranty_seq" Visible ="false" />
                                            <asp:Label CssClass="font-label" runat = "server" ID= "hAssetStatus" Visible ="false" />
                                        </td>
                                        <td class="command-item">
                                            <asp:LinkButton ID="btnCancel" runat="server" CssClass="LinkButton" OnClick="btnCancel_Click">
                                                <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cancel.gif" />&nbsp;&nbsp;ยกเลิกข้อมูล
                                            </asp:LinkButton>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                     </div>
              </div>                        
         <div class="moduleContent780">
              <div class="moduleDivBottom780">
                     <asp:Panel ID="Panel1" runat="server" CssClass="contentPaneDiv" Height="299px" Width="760px" ScrollBars="Auto"  >  
                               <div class="formList-detail">
                                       <table>
                                             <tr>
                                                    <td>
                                                         <asp:Label CssClass="font-label" runat = "server" ID= "lblAssetCode" Text = "รหัสพัสดุ (ที่มีการตรวจนับ) : " Font-Bold="true"/>
                                                    </td>
                                                    <td>
                                                         <asp:Label CssClass="font-label" runat = "server" ID= "pAssetCode" Visible ="true" />
                                                    </td>
                                             </tr>
                                       </table>
                                </div>
                                <div class="formList-detail">
                                                   <table>
                                                         <tr>
                                                                <td>
                                                                     <asp:Label CssClass="font-label" runat = "server" ID= "lblWarrantyDesc" Text = "รายละเอียดการประกันพัสดุ : " Font-Bold="true"/>
                                                                </td>
                                                                <td>
                                                                     <telerik:RadTextBox ID="txtWarrantyDesc" runat="server" title="รายละเอียดการประกันพัสดุ" Width="450px" TextMode="MultiLine" Height="70px"></telerik:RadTextBox>  
                                                                     &nbsp;<label id="Label3" runat="server"><font color="red">*</font></label>
                                                                </td>
                                                         </tr>
                                                   </table>
                                </div>
                                <div class="formList-detail">
                                       <table>
                                             <tr>
                                                    <td valign="top" width="170px">
                                                        <asp:Label CssClass="font-label" runat = "server" ID= "Label1" Text = "วันที่รับเข้า           : " Font-Bold="true"/>
                                                        </td>
                                                    <td >
                                                        <telerik:RadMaskedTextBox ID="txtReceiveDate" runat="server" Mask=" ##/##/####" SelectionOnFocus="SelectAll" TextWithLiterals=" //" Width="75px">
                                                        </telerik:RadMaskedTextBox>
                                                    </td>
                                                    <td>
                                                          <asp:LinkButton ID="lbtReceiveDate" runat="server" CssClass="LinkButton">
                                                                <img alt="" src="../Image/Icon/Calendar.gif" style="border:0px;vertical-align:middle;" />
                                                          </asp:LinkButton>
                                                          <telerik:RadToolTip ID="ToolTipReceiveDate" runat="server" Animation="None" HideEvent="LeaveToolTip" Position="MiddleRight" ShowEvent="OnClick" Skin="Telerik" 
                                                            TargetControlID="lbtReceiveDate" Modal="true">
                                                                <telerik:RadCalendar id="CalendarReceiveDate" runat="server" TitleFormat="MMMM yyyy" EnableMultiSelect="false" UseRowHeadersAsSelectors="false" UseColumnHeadersAsSelectors="false" DayCellToolTipFormat="dddd, dd MMMM, yyyy" NavigationPrevToolTip="เดือนก่อนหน้า" NavigationNextToolTip="เดือนถัดไป" FastNavigationNextToolTip="3 เดือนถัดไป" FastNavigationPrevToolTip="3 เดือนก่อนหน้า">
                                                                    <ClientEvents OnDateClick="OnReceiveDateClick" OnCalendarViewChanged="OnCalendarReceiveViewChanged"></ClientEvents>
                                                                    <FastNavigationSettings EnableTodayButtonSelection="true" TodayButtonCaption="ไปที่วันนี้" OkButtonCaption="เปลี่ยน" CancelButtonCaption="ยกเลิก" />
                                                                </telerik:RadCalendar>
                                                          </telerik:RadToolTip>
                                                            &nbsp;<label id="Label2" runat="server"><font color="red">*</font></label>
                                                    </td>
                                                    <td valign="top" width="170px">
                                                        <asp:Label CssClass="font-label" runat = "server" ID= "lblEndDate" Text = "วันที่สุดท้ายที่อยู่ในสถานที่นี้          : " Font-Bold="true"/>
                                                        </td>
                                                    <td >
                                                        <telerik:RadMaskedTextBox ID="txtEndDate" runat="server" Mask=" ##/##/####" SelectionOnFocus="SelectAll" TextWithLiterals=" //" Width="75px">
                                                        </telerik:RadMaskedTextBox>
                                                    </td>
                                                    <td>
                                                          <asp:LinkButton ID="lbtEndDate" runat="server" CssClass="LinkButton">
                                                                <img alt="" src="../Image/Icon/Calendar.gif" style="border:0px;vertical-align:middle;" />
                                                          </asp:LinkButton>
                                                          <telerik:RadToolTip ID="ToolTipEndDate" runat="server" Animation="None" HideEvent="LeaveToolTip" Position="MiddleRight" ShowEvent="OnClick" Skin="Telerik" 
                                                            TargetControlID="lbtEndDate" Modal="true">
                                                                <telerik:RadCalendar id="CalendarEndDate" runat="server" TitleFormat="MMMM yyyy" EnableMultiSelect="false" UseRowHeadersAsSelectors="false" UseColumnHeadersAsSelectors="false" DayCellToolTipFormat="dddd, dd MMMM, yyyy" NavigationPrevToolTip="เดือนก่อนหน้า" NavigationNextToolTip="เดือนถัดไป" FastNavigationNextToolTip="3 เดือนถัดไป" FastNavigationPrevToolTip="3 เดือนก่อนหน้า">
                                                                    <ClientEvents OnDateClick="OnEndDateClick" OnCalendarViewChanged="OnCalendarEndViewChanged"></ClientEvents>
                                                                    <FastNavigationSettings EnableTodayButtonSelection="true" TodayButtonCaption="ไปที่วันนี้" OkButtonCaption="เปลี่ยน" CancelButtonCaption="ยกเลิก" />
                                                                </telerik:RadCalendar>
                                                          </telerik:RadToolTip>
                                                    </td>
                                             </tr>
                                     </table>
                                </div>
                                <div class="formList-detail">
                                                   <table>
                                                         <tr>
                                                                <td>
                                                                     <asp:Label CssClass="font-label" runat = "server" ID= "lblWarrantyRemark" Text = "หมายเหตุเพิ่มเติม : " Font-Bold="true"/>
                                                                </td>
                                                                <td>
                                                                     <telerik:RadTextBox ID="txtWarrantyRemark" runat="server" title="หมายเหตุเพิ่มเติม" TextMode="MultiLine" Width="450px" Height="70px"></telerik:RadTextBox>  
                                                                </td>
                                                         </tr>
                                                   </table>
                                </div>
                     </asp:Panel>
                     
                     
             </div>
      </div>                        
            
    </form>
</body>
</html>
